﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
<<<<<<< HEAD
using System.Threading;
using static System.Console;

namespace EventText
{
    public delegate void AlarmClockRun();
    public class AlarmClock
    {
        public event AlarmClockRun ClockTick;
        public event AlarmClockRun ClockAlarm;
        private int myhour;
        private int myminute;
        private int mysecond;
        public AlarmClock(int hour,int minute,int second)
        { 
            myhour = hour;
            myminute = minute;
            mysecond = second;
        }
        public void Tick()
        {
                WriteLine("闹钟在" + DateTime.Now.ToLongTimeString().ToString()+"滴答");
        }
        public void Alarm()
        {
            WriteLine("我的闹钟响了！");
        }
        public void start()
        {
            while (true)
            {
                ClockTick();
                if (DateTime.Now.Hour == myhour && DateTime.Now.Minute == myminute && DateTime.Now.Second == mysecond)
                    ClockAlarm();
                Thread.Sleep(1000);
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            AlarmClock clock1 = new AlarmClock(11, 31,10);
            clock1.ClockTick += clock1.Tick;
            clock1.ClockAlarm += clock1.Alarm;
            clock1.start();
=======
using static System.Console;

namespace ConsoleApplication3
{
    class Program
    {
        static int GetMax(int[]a,int n)
        {
            int max=a[0];
            for(int i=0;i< n; i++)
            {
                if (a[i] > max) max = a[i];
            }
            return max;
        }

        static int GetMin(int[] a, int n)
        {
            int min = a[0];
            for (int i = 0; i < n; i++)
            {
                if (a[i] < min) min = a[i];
            }
            return min;
        }

        static int GetSum(int[]a,int n)
        {
            int sum=0;
            for (int i = 0; i < n; i++) sum += a[i];
            return sum;
        }

        static int Getaverge(int[]a,int n)
        {
            return GetSum(a, n) / n;
        }
        static void Main(string[] args)
        {
            while (true)
            {
                Write("请输入数组长度：");
                int n = Int32.Parse(ReadLine());
                int[] arry = new int[n];
                WriteLine("请输入数组元素：");
                for (int i = 0; i < n; i++)
                {
                    arry[i] = Int32.Parse(ReadLine());
                }
                WriteLine("数组最大值：" + GetMax(arry, n));
                WriteLine("数组最小值：" + GetMin(arry, n));
                WriteLine("数组之和：" + GetSum(arry, n));
                WriteLine("数组平均值：" + Getaverge(arry, n));
                WriteLine();
            }
>>>>>>> 5ef73b757075c80cc034353a7bb5d41a841de922
        }
    }
}
